﻿@using NGroup.VTL.Models;
@using NGroup.VTL.Core.Const;
@model NewsModel
@{
    ViewBag.Title = "Quản trị - Đăng bài viết mới";
    Layout = "~/Views/Shared/_AdminLayout.cshtml";
}
@section Head{
    <script type="text/javascript" src="@Url.Content("~/Content/script/vtl.ajax.js")"></script>
    <script type="text/javascript" src="@Url.Content("~/Content/adminpages/ckeditor/ckeditor.js")"></script>
    <script type="text/javascript" src="@Url.Content("~/Content/adminpages/ckfinder/ckfinder.js")"></script>
    <script type="text/javascript" src="@Url.Content("~/Content/script/jquery.idTabs.min.js")"></script>
    <link type="text/javascript" href="@Url.Content("~/Content/adminpages/sample.css")" />
    <script type="text/javascript">
        $(document).ready(function () {
            CKEDITOR.replace("BriefContent", {
                toolbar: [{ name: 'document', items: ['Source', '-', 'NewPage', 'Preview'] }, // Defines toolbar group with name (used to create voice label) and items in 3 subgroups.
		['Cut', 'Copy', 'Paste', 'PasteText', 'PasteFromWord', '-', 'Undo', 'Redo'], 		// Defines toolbar group without name.
                //'/', 																				// Line break - next group will be placed in new line.
		{name: 'basicstyles', items: ['Bold', 'Italic', 'Underline', 'Strike', 'Subscript', 'Superscript', '-', 'RemoveFormat']}]
            });
            CKEDITOR.replace("BriefContentEn", {
                toolbar: [{ name: 'document', items: ['Source', '-', 'NewPage', 'Preview'] }, // Defines toolbar group with name (used to create voice label) and items in 3 subgroups.
		['Cut', 'Copy', 'Paste', 'PasteText', 'PasteFromWord', '-', 'Undo', 'Redo'], 		// Defines toolbar group without name.
                //'/', 																				// Line break - next group will be placed in new line.
		{name: 'basicstyles', items: ['Bold', 'Italic', 'Underline', 'Strike', 'Subscript', 'Superscript', '-', 'RemoveFormat']}]
            });
            CKEDITOR.replace("FullContent");
            CKEDITOR.replace("FullContentEn");

            $("#producttabs ul").idTabs();

            $("#product_link").blur(function () {
                var uniqueString = $("#product_link").val();

                if (!uniqueString != false) {
                    $(".existing").hide();
                    return false;
                }

                var act = "/vuarao/CheckUniqueString";
                var typeID = $("#presentativeTypeID").val(); // News content type ID
                CheckUniqueString(act, uniqueString, typeID, ActAfterCheckUniqueString);
            });

            $("#btnDangBaiViet").mousedown(function () {
                var invalidLink = $("#product_link").hasClass("input-validation-error");

                if (invalidLink == true) {
                    return false;
                }
            });

        });

        function ActAfterCheckUniqueString(isExistingUniqueString) {
            if (isExistingUniqueString === 'True') {
                $(".existing").show();
                $("#product_link").addClass("input-validation-error");
            }
            else {
                $(".existing").hide();
                $("#product_link").removeClass("input-validation-error");
            }
        }
    </script>
}
<div class="clear">
</div>
<!-- End .clear -->
<div class="content-box">
    <!-- Start Content Box -->
    <div class="content-box-header">
        <h3>
            Tin tức mới</h3>
        <div class="filterGroup">
            <a href="#question" title="Hướng dẫn" rel="modal">
                <img src="@Url.Content("~/Content/adminpages/images/icons/question.png")" alt="Hướng dẫn" /></a>
        </div>
        <div class="clear">
        </div>
    </div>
    <!-- End .content-box-header -->
    <div class="content-box-content">
        <div class="tab-content default-tab" id="tab1">
            @using (Html.BeginForm("dang_bai_viet_moi", "vuarao", FormMethod.Post, new { @id = "formPostNewNews", @class = "formPostNew" }))
            {   
                <p>
                    <label>
                        Tiêu đề tin tức (Vi)</label>
                    @Html.TextBoxFor(x => x.Title, new { @class = "text-input medium-input", @placeholder = "Tiêu đề tin tức", @type = "text", @id = "news_title", @maxlength = "1500" })
                    <input type="hidden" value="4" id="presentativeTypeID" />
                    <br />
                </p>
                
                <p>
                    <label>
                        Tiêu đề tin tức (En)</label>
                    @Html.TextBoxFor(x => x.TitleEn, new { @class = "text-input medium-input", @placeholder = "Tiêu đề tin tức", @type = "text", @id = "news_title_en", @maxlength = "1500" })
                    <br />
                </p>
                
                <p>
                    <label>
                        Meta description (Vi)</label>
                    @Html.TextBoxFor(x => x.MetaDescription, new { @class = "text-input medium-input", @placeholder = "Meta description", @type = "text", @id = "meta_descriptione", @maxlength = "1500" })
                    @*<input class="text-input medium-input" title="Meta keyword" type="text" id="meta_keyworde" />*@
                    <br />
                </p>
                
                <p>
                    <label>
                        Meta description (En)</label>
                    @Html.TextBoxFor(x => x.MetaDescriptionEn, new { @class = "text-input medium-input", @placeholder = "Meta description", @type = "text", @id = "meta_descriptione_en", @maxlength = "1500" })
                    <br />
                </p>
              
                <p>
                    <label>
                        Meta keyword (Vi)</label>
                    @Html.TextBoxFor(x => x.MetaContent, new { @class = "text-input medium-input", @placeholder = "Meta keyword", @type = "text", @id = "meta_keyworde", @maxlength = "1500" })
                    @*<input class="text-input medium-input" title="Meta keyword" type="text" id="meta_keyworde" />*@
                    <br />
                </p>
                
                <p>
                    <label>
                        Meta keyword (En)</label>
                    @Html.TextBoxFor(x => x.MetaContentEn, new { @class = "text-input medium-input", @placeholder = "Meta keyword", @type = "text", @id = "meta_keyworde_en", @maxlength = "1500" })
                    <br />
                </p>
                
                <p>
                    <label>
                        Liên kết</label>
                    @Html.TextBoxFor(x => x.UniqueString, new { @class = "text-input medium-input", @placeholder = "Liên kết", @type = "text", @id = "product_link", @maxlength = "500" })
                    <span class="input-notification attention png_bg existing" style="display: none;">Liên
                        kết này đã được sử dụng ở 1 bài viết khác</span> @*<input class="text-input medium-input" title="Liên kết" type="text" id="product_link" />*@
                    @*<span class="input-notification success png_bg">Successful message</span> <!{1}**
                    Classes for input-notification: success, error, information, attention **{1}>*@
                    <br />
                </p>
                <p>
                    <label>
                        Hình đại diện (Vi)</label>
                    @Html.TextBoxFor(x => x.ImageSmallURL, new { @class = "text-input medium-input", @type = "text", @placeholder = "Hình đại diện", @id = "hinh_dai_dien", @maxlength = "500" })
                    @*<input class="text-input medium-input" type="text" title="Hình đại diện" id="hinh_dai_dien"
                        name="medium-input" />*@
                    <input class="button btnBrowse" ref="#hinh_dai_dien" type="button" value="Chọn hình" />
                    @*<span class="input-notification error png_bg">Error message</span>*@
                </p>
                <p>
                    <label>
                        Hình đại diện (En)</label>
                    @Html.TextBoxFor(x => x.ImageSmallURLEn, new { @class = "text-input medium-input", @type = "text", @placeholder = "Hình đại diện", @id = "hinh_dai_dien_en", @maxlength = "500" })
                    @*<input class="text-input medium-input" type="text" title="Hình đại diện" id="hinh_dai_dien"
                        name="medium-input" />*@
                    <input class="button btnBrowse" ref="#hinh_dai_dien_en" type="button" value="Chọn hình" />
                    @*<span class="input-notification error png_bg">Error message</span>*@
                </p>
                <p>
                    <div id="producttabs" class="tabsContent cleared">
                        <ul>
                            <li><a href="#tabs-1" class="selected">Nội dung rút gọn (Vi)</a></li>
                            <li><a href="#tabs-2">Nội dung chi tiết (Vi)</a></li>
                            <li><a href="#tabs-3">Nội dung rút gọn (En)</a></li>
                            <li><a href="#tabs-4">Nội dung chi tiết (En)</a></li>
                            @*<li><a href="#tabs-3">Nội dung tab Chi Tiết Thanh Toán</a></li>*@
                        </ul>
                        <div id="tabs-1">
                            @Html.TextAreaFor(x => x.BriefContent, new { @id = "BriefContent" })
                        </div>
                        <div id="tabs-2">
                            @Html.TextAreaFor(x => x.FullContent, new { @id = "FullContent" })
                        </div>
                        <div id="tabs-3">
                            @Html.TextAreaFor(x => x.BriefContentEn, new { @id = "BriefContentEn" })
                        </div>
                        <div id="tabs-4">
                            @Html.TextAreaFor(x => x.FullContentEn, new { @id = "FullContentEn" })
                        </div>
                        @*<div id="tabs-3">
                            @Html.TextAreaFor(x => x.DeliveryDetail, new { @id = "DeliveryDetail" })
                        </div>*@
                    </div>
                    @*<textarea id="ckEditor" rows="100" cols="30"></textarea>*@ @*<textarea class="text-input textarea wysiwyg" id="textarea" name="textfield" cols="79"
                    rows="15"></textarea>*@
                </p>
                <p>
                    <input class="button" type="submit" value="Đăng bài viết" id="btnDangBaiViet" />
                </p>
                <div class="clear">
                </div>
            }
        </div>
        <!-- End #tab2 -->
    </div>
    <!-- End .content-box-content -->
</div>
<!-- End .content-box -->
@section Lazy{
    <script type="text/javascript">
        $(".current").removeClass("current");
        $("#dang-bai-viet-moi").addClass("current");
        $("#dang-bai-viet-moi").parent("ul").css("display", "inherit");
        $("#qlbv").addClass("current");
    </script>
}
